From e018256bfbfa1fbd8b0a598b219171ddd0e2fe17 Mon Sep 17 00:00:00 2001 From: Dongxiao Xu Date: Thu, 6 Dec 2012 16:58:59 +0000 Subject: [PATCH] nested vmx: fix interrupt delivery to L2 guest While delivering interrupt into L2 guest, L0 hypervisor need to check whether L1 hypervisor wants to own the interrupt, if not, directly inject the interrupt into L2 guest. Signed-off-by: Xiantao Zhang Signed-off-by: Dongxiao Xu Acked-by: Jan Beulich Committed-by: Keir Fraser --- xen/arch/x86/hvm/vmx/intr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 3961bc73db..ef8b9253c8 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -163,7 +163,7 @@ enum hvm_intblk nvmx_intr_blocked(struct vcpu *v) static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack) { - u32 exit_ctrl; + u32 ctrl; if ( nvmx_intr_blocked(v) != hvm_intblk_none ) { @@ -176,11 +176,14 @@ static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack) if ( intack.source == hvm_intsrc_pic || intack.source == hvm_intsrc_lapic ) { + ctrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, PIN_BASED_VM_EXEC_CONTROL); + if ( !(ctrl & PIN_BASED_EXT_INTR_MASK) ) + return 0; + vmx_inject_extint(intack.vector); - exit_ctrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, - VM_EXIT_CONTROLS); - if ( exit_ctrl & VM_EXIT_ACK_INTR_ON_EXIT ) + ctrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, VM_EXIT_CONTROLS); + if ( ctrl & VM_EXIT_ACK_INTR_ON_EXIT ) { /* for now, duplicate the ack path in vmx_intr_assist */ hvm_vcpu_ack_pending_irq(v, intack); -- 2.30.2